package com.zjitc.mapper;

import com.zjitc.pojo.Product;
import jdk.nashorn.internal.objects.annotations.Setter;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * Create by IntelliJ IDEA
 *
 * @author: jsonor
 * @date-Time: 2018/3/12 16:16
 * @description:
 */
public interface ProductMapper {
  @Select("select * from product")
  Product findProduct();

  @Select("select * from product where product_id=#{product_id}")
  Product findById(Integer product_id);

  @Insert("insert into product(product_name,product_price,product_count,product_type)"
              + " values(#{product_name},#{product_price},#{product_count},#{product_type})")
  void add();

  @Delete("delete * from product where product_id=#{product_id}")
  int deleteById(Integer product_id);

  @Update("update product set product_name=#{product_name},product_price=#{product_price},"
              + "product_count=#{product_count},product_type=#{product_type} where product_id=#{product_id}")
  int updateById(Integer product_id);
//
}
